﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Yuanlin.Business;
using System.Web.Core;

public partial class Themes_Default_Masters_FrontEndIFrameContentMaster : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        OnlineMemberManager.Instance.TrackingUser(HttpContext.Current.Request.RawUrl);
        GetTitle();
    }

    private void GetTitle()
    {
        string title = ResourceManager.GetString("CompanyHome");
        if (Head.Instance.Title == ResourceManager.GetString("Huamu"))
        {
            #region 花木

            switch (UrlManager.Instance.GetParameterValue<string>(YuanlinParameterName.TradeType))
            {
                case "0":
                    title = ResourceManager.GetString("Huamu");
                    break;
                case "1":
                    title = ResourceManager.GetString("Huamujingpin");
                    break;
                case "2":
                    title = ResourceManager.GetString("Huamuqiugou");
                    break;
                case "3":
                    title = ResourceManager.GetString("Huamujishou");
                    break;
            }

            #endregion
        }
        else if (Head.Instance.Title == ResourceManager.GetString("zicai"))
        {
            #region 资材

            string kind = UrlManager.Instance.GetParameterValue<string>(YuanlinParameterName.Kind);
            string TradeType = UrlManager.Instance.GetParameterValue<string>(YuanlinParameterName.TradeType);
            if (kind == "1")//机械
            {
                if (TradeType == "0")//出售
                {
                    title = ResourceManager.GetString("CompanyMachineChuShou");
                }
                else if (kind == "1")//求购
                {
                    title = ResourceManager.GetString("CompanyMachineQiuGou");
                }
            }
            else if (kind == "2")//设施
            {
                if (TradeType == "0")//出售
                {
                    title = ResourceManager.GetString("CompanyFacilityChuShou");
                }
                else if (kind == "1")//求购
                {
                    title = ResourceManager.GetString("CompanyFacilityQiuGou");
                }
            }
            else if (kind == "3")//农资
            {
                if (TradeType == "0")//出售
                {
                    title = ResourceManager.GetString("CompanyAgriculturalChuShou");
                }
                else if (TradeType == "1")//求购
                {
                    title = ResourceManager.GetString("CompanyAgriculturalQiuGou");
                }
            }
            else if (kind == "5")//饲料
            {
                if (TradeType == "0")//出售
                {
                    title = ResourceManager.GetString("CompanyMashChuShou");
                }
                else if (TradeType == "1")//求购
                {
                    title = ResourceManager.GetString("CompanyMashQiuGou");
                }
            }
            #endregion
        }
        else if (Head.Instance.Title == ResourceManager.GetString("Fishery"))
        {
            #region 水产

            switch (UrlManager.Instance.GetParameterValue<string>(YuanlinParameterName.TradeType))
            {
                case "0":
                    title = ResourceManager.GetString("Fishery");
                    break;
                case "1":
                    title = ResourceManager.GetString("FisheryJingPin");
                    break;
                case "2":
                    title = ResourceManager.GetString("FisheryQiuGou");
                    break;
                case "3":
                    title = ResourceManager.GetString("FisheryJiShou");
                    break;
            }

            #endregion
        }
        else if (Head.Instance.Title.Length > 0)
        {
            title = Head.Instance.Title;
        }
        if (!this.Page.ClientScript.IsClientScriptBlockRegistered("title"))
        {
            this.Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "title", string.Format("parent.frames.document.title='{0}';",title), true);
        }
    }
}
